import 'package:helloword/retrofit/kaiyan_entity.dart';

kaiyanEntityFromJson(KaiyanEntity data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['actionUrl'] != null) {
		data.actionUrl = json['actionUrl'].toString();
	}
	if (json['adTrack'] != null) {
		data.adTrack = json['adTrack'];
	}
	if (json['desc'] != null) {
		data.desc = json['desc'];
	}
	if (json['bgPicture'] != null) {
		data.bgPicture = json['bgPicture'].toString();
	}
	if (json['headerImage'] != null) {
		data.headerImage = json['headerImage'].toString();
	}
	if (json['tagRecType'] != null) {
		data.tagRecType = json['tagRecType'].toString();
	}
	if (json['childTagList'] != null) {
		data.childTagList = json['childTagList'];
	}
	if (json['childTagIdList'] != null) {
		data.childTagIdList = json['childTagIdList'];
	}
	if (json['haveReward'] != null) {
		data.haveReward = json['haveReward'];
	}
	if (json['ifNewest'] != null) {
		data.ifNewest = json['ifNewest'];
	}
	if (json['newestEndTime'] != null) {
		data.newestEndTime = json['newestEndTime'];
	}
	if (json['communityIndex'] != null) {
		data.communityIndex = json['communityIndex'] is String
				? int.tryParse(json['communityIndex'])
				: json['communityIndex'].toInt();
	}
	return data;
}

Map<String, dynamic> kaiyanEntityToJson(KaiyanEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['actionUrl'] = entity.actionUrl;
	data['adTrack'] = entity.adTrack;
	data['desc'] = entity.desc;
	data['bgPicture'] = entity.bgPicture;
	data['headerImage'] = entity.headerImage;
	data['tagRecType'] = entity.tagRecType;
	data['childTagList'] = entity.childTagList;
	data['childTagIdList'] = entity.childTagIdList;
	data['haveReward'] = entity.haveReward;
	data['ifNewest'] = entity.ifNewest;
	data['newestEndTime'] = entity.newestEndTime;
	data['communityIndex'] = entity.communityIndex;
	return data;
}